﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Platformer
{
    public class Minigun : Weapon
    {
        public Minigun(PlatformerGame game)
            : base(game)
        {
            fireRate = 5;
            damage = 25;
            texture = game.Content.Load<Texture2D>("Character/Weapons/gun");
        }

        public override void Update()
        {
            position = new Vector2(game.Player.Position.X + game.Player.Size.X - 20, game.Player.Position.Y + 22);
        }

        /* Custom */
        protected override void CreateBullet()
        {
            Vector2 dir = game.Player.AimPosition - game.Player.Position - new Vector2(game.Player.aim.Width / 2, game.Player.aim.Height / 2);
            Vector2 pos = new Vector2(game.Player.Position.X + 50, game.Player.Position.Y + 25);
            dir.Normalize();
            GunBullet temp = new GunBullet(game, pos, dir);
            game.Player.BulletList.Add(temp);
        }
    }

    public class MinigunBullet : Bullet
    {
        public MinigunBullet(PlatformerGame game, Vector2 position, Vector2 direction)
            : base(game, position, direction)
        {
            size = new Point(10, 10);
            texture = game.Content.Load<Texture2D>("Bullets/bullet1");
            speed = 10f;
        }

        public override void Update()
        {
            CheckWasted();
            BasicMovement();
            base.Update();
        }

    }
}
